﻿@using Newtouch.Infrastructure;
@{
    ViewBag.Title = "新农合参保人列表";
    Layout = "~/Views/Shared/_Form.cshtml";
    var from = (ViewBag.from as string) ?? "";
}

<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>
<script>
    var $gridList = $("#gridList");

    $(function () {
        gridList();
        var data = JSON.parse(localStorage.getItem("jrespdata"));
        if (!!data) {
            $('#gridList').newtouchLocalDataGrid(null, data);
            localStorage.removeItem("jrespdata");
        }
    });


    function gridList() {
        $gridList.newtouchLocalDataGrid({
            unwritten: false,
            height: $(window).height() - 70,
            colModel: [
                { label: 'memberId', name: 'memberId', hidden: true },
                { label: 'medicalNo', name: 'medicalNo', hidden: true },
                { label: '姓名', name: 'memberName', width: 100, align: 'left' },
                {
                    label: '性别', name: 'memberSex', width: 30, align: 'left', formatter: function (cellvalue) {
                        return $.getGender(cellvalue);
                    }
                },
                { label: '身份证号', name: 'idCard', width: 160, align: 'left' },
                { label: '年龄', name: 'memberAge', width: 50, align: 'left' },
                {
                    label: '出生年月', name: 'birthday', width: 90, align: 'left',
                    formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' }
                },
                { label: '地址', name: 'areaName', width: 160, align: 'left' },
                { label: '账户余额', name: 'account', width: 50, align: 'left' },
                { label: '参保状态', name: 'memberStauts', width: 50, align: 'left' },
                { label: '普通住院总费用', name: 'hosTotalCost', width: 75, align: 'left' },
                { label: '普通住院保内费用', name: 'hosInsuranceCost', width: 85, align: 'left' },
                { label: '普通住院补偿费用', name: 'hosCompens', width: 85, align: 'left' },
            ],
            pager: "#gridPager",
            sortname: 'isnull(LastModifyTime, CreateTime) desc',
            rowNum: '15',
            viewrecords: true,
            ondblClickRow: function (rowid, iRow, iCol, e) {
                PatDbGrid(rowid);
            }
        });
    }

    function PatDbGrid(rowId) {
        var rowData = $gridList.jqGrid('getRowData', rowId);
        var obj = new Object();
        obj.xnhgrbm = rowData.memberId;
        obj.xnhylzh = rowData.medicalNo;
        obj.xm = rowData.memberName;
        obj.xb = rowData.memberSex;
        obj.zjlx =@((int)EnumZJLX.sfz);
        obj.brxzmc = "新农合";
        obj.brxzcode = "8";
        obj.zjh = rowData.idCard;
        obj.csny = rowData.birthday;
        obj.xian_dz = rowData.areaName;
        obj.zhye = rowData.account;
        $.currentWindow().GetSelectedpatient(obj);
        $.modalClose();
    }
</script>


